package ru.cod.rs.types;

import ru.cod.rs.enums.Direction;

public class Speed {

	public Speed(int value, Direction dir) {
		this.value = value;
		direction = dir;
	}

	// ///////////////////////////////////////
	private int value;
	private Direction direction;

	// ///////////////////////////////////////
	public void togleDirection() {
		// TODO: рассмотреть рефакторинг через FSM
		switch (direction) {
		case LEFT:
			direction = Direction.RIGHT;
			break;
		case RIGHT:
			direction = Direction.LEFT;
			break;
		case UP:
			direction = Direction.DOWN;
			break;
		case DOWN:
			direction = Direction.UP;
			break;
		default:
			direction = Direction.NOWHERE;
		}
	}

	// ///////////////////////////////////////

	/**
	 * @return the value
	 */
	public int getValue() {
		return value;
	}

	/**
	 * @param value
	 *            the value to set
	 */
	public void setValue(int value) {
		this.value = value;
	}

	/**
	 * @return the direction
	 */
	public Direction getDirection() {
		return direction;
	}

	/**
	 * @param direction
	 *            the direction to set
	 */
	public void setDirection(Direction direction) {
		this.direction = direction;
	}

}
